--
-- PostgreSQL database dump
--

-- Started on 2012-11-09 10:38:32

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- TOC entry 448 (class 2612 OID 16386)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

CREATE PROCEDURAL LANGUAGE plpgsql;


ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- TOC entry 141 (class 1259 OID 16581)
-- Dependencies: 3
-- Name: anuncio; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE anuncio (
    id_anuncio integer NOT NULL,
    id_usuario integer NOT NULL,
    titulo character varying(50),
    descripcion character varying(250),
    categoria character varying(20),
    fecha_publicacion date,
    fecha_finalizacion date,
    url character varying(250),
    link character varying(250)
);


ALTER TABLE public.anuncio OWNER TO postgres;

--
-- TOC entry 140 (class 1259 OID 16579)
-- Dependencies: 3 141
-- Name: anuncio_id_anuncio_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE anuncio_id_anuncio_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.anuncio_id_anuncio_seq OWNER TO postgres;

--
-- TOC entry 1796 (class 0 OID 0)
-- Dependencies: 140
-- Name: anuncio_id_anuncio_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE anuncio_id_anuncio_seq OWNED BY anuncio.id_anuncio;


--
-- TOC entry 1797 (class 0 OID 0)
-- Dependencies: 140
-- Name: anuncio_id_anuncio_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('anuncio_id_anuncio_seq', 1, false);


--
-- TOC entry 143 (class 1259 OID 16594)
-- Dependencies: 3
-- Name: usuario; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE usuario (
    id_usuario integer NOT NULL,
    username character varying(20),
    password character varying(20),
    nombre character varying(40),
    apellido character varying(40),
    tipo_usuario character varying(20),
    e_mail character varying(50)
);


ALTER TABLE public.usuario OWNER TO postgres;

--
-- TOC entry 142 (class 1259 OID 16592)
-- Dependencies: 143 3
-- Name: usuario_id_usuario_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE usuario_id_usuario_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.usuario_id_usuario_seq OWNER TO postgres;

--
-- TOC entry 1798 (class 0 OID 0)
-- Dependencies: 142
-- Name: usuario_id_usuario_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE usuario_id_usuario_seq OWNED BY usuario.id_usuario;


--
-- TOC entry 1799 (class 0 OID 0)
-- Dependencies: 142
-- Name: usuario_id_usuario_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('usuario_id_usuario_seq', 1, false);


--
-- TOC entry 1779 (class 2604 OID 16584)
-- Dependencies: 140 141 141
-- Name: id_anuncio; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY anuncio ALTER COLUMN id_anuncio SET DEFAULT nextval('anuncio_id_anuncio_seq'::regclass);


--
-- TOC entry 1780 (class 2604 OID 16597)
-- Dependencies: 142 143 143
-- Name: id_usuario; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY usuario ALTER COLUMN id_usuario SET DEFAULT nextval('usuario_id_usuario_seq'::regclass);


--
-- TOC entry 1789 (class 0 OID 16581)
-- Dependencies: 141
-- Data for Name: anuncio; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY anuncio (id_anuncio, id_usuario, titulo, descripcion, categoria, fecha_publicacion, fecha_finalizacion, url, link) FROM stdin;
1	1	requerimiento de personas	la empresa xx requiere estudiantes del area se informatica	convocatoria	2012-11-09	2012-11-25	a	b
2	1	fiesta	fiesta carrera sistemas	eventos	2012-11-09	2012-11-15	c	d
\.


--
-- TOC entry 1790 (class 0 OID 16594)
-- Dependencies: 143
-- Data for Name: usuario; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY usuario (id_usuario, username, password, nombre, apellido, tipo_usuario, e_mail) FROM stdin;
1	alex	124	alex	flores	estudiante	alex@gmail.com
\.


--
-- TOC entry 1783 (class 2606 OID 16589)
-- Dependencies: 141 141
-- Name: pk_anuncio; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY anuncio
    ADD CONSTRAINT pk_anuncio PRIMARY KEY (id_anuncio);


--
-- TOC entry 1786 (class 2606 OID 16599)
-- Dependencies: 143 143
-- Name: pk_usuario; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY usuario
    ADD CONSTRAINT pk_usuario PRIMARY KEY (id_usuario);


--
-- TOC entry 1781 (class 1259 OID 16590)
-- Dependencies: 141
-- Name: anuncio_pk; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE UNIQUE INDEX anuncio_pk ON anuncio USING btree (id_anuncio);


--
-- TOC entry 1784 (class 1259 OID 16591)
-- Dependencies: 141
-- Name: tiene_fk; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX tiene_fk ON anuncio USING btree (id_usuario);


--
-- TOC entry 1787 (class 1259 OID 16600)
-- Dependencies: 143
-- Name: usuario_pk; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE UNIQUE INDEX usuario_pk ON usuario USING btree (id_usuario);


--
-- TOC entry 1788 (class 2606 OID 16601)
-- Dependencies: 1785 143 141
-- Name: fk_anuncio_tiene_usuario; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY anuncio
    ADD CONSTRAINT fk_anuncio_tiene_usuario FOREIGN KEY (id_usuario) REFERENCES usuario(id_usuario) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- TOC entry 1795 (class 0 OID 0)
-- Dependencies: 3
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


-- Completed on 2012-11-09 10:38:32

--
-- PostgreSQL database dump complete
--

